<!doctype html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <meta name="description" content="">
    <meta name="author" content="Mark Otto, Jacob Thornton, and Bootstrap contributors">
    <meta name="generator" content="Jekyll v4.0.1">
    <title>Dashboard Template · Bootstrap</title>

    <link rel="canonical" href="https://getbootstrap.com/docs/4.5/examples/dashboard/">

    <!-- Bootstrap core CSS -->
    <link th:href="@{/assets/dist/css/bootstrap.css}" rel="stylesheet">

    <style>
        .bd-placeholder-img {
            font-size: 1.125rem;
            text-anchor: middle;
            -webkit-user-select: none;
            -moz-user-select: none;
            -ms-user-select: none;
            user-select: none;
        }

        @media (min-width: 768px) {
            .bd-placeholder-img-lg {
                font-size: 3.5rem;
            }
        }
    </style>
    <!-- Custom styles for this template -->
    <link th:href="@{/css/dashboard.css}" rel="stylesheet">
</head>
<body>
<!--顶部导航栏-->
<div th:replace="~{commons/commons::topbar}"></div>

<div class="container-fluid">
    <div class="row">
        <!--侧边栏-->
        <div th:replace="~{commons/commons::sidebar(active='list')}"></div>

        <main role="main" class="col-md-9 ml-sm-auto col-lg-10 px-md-4">
            <!--添加员工按钮，点击后跳转到添加员工页面-->
            <h2><a class="btn btn-sm btn-success" th:href="@{/emp}">添加员工</a></h2>
            <div class="table-responsive">
                <table class="table table-striped table-sm">
                    <thead>
                    <tr>
                        <th>ID</th>
                        <th>姓名</th>
                        <th>邮箱</th>
                        <th>性别</th>
                        <th>部门</th>
                        <th>生日</th>
                    </tr>
                    </thead>
                    <tbody>
                    <tr th:each="emp:${emps}">
                        <td th:text="${emp.id}"></td>
                        <td th:text="${emp.lastName}"></td>
                        <td th:text="${emp.email}"></td>
                        <td th:text="${emp.gender==1?'男':'女'}"></td>
                        <td th:text="${emp.department.getDepartmentName()}"></td>
                        <td th:text="${#dates.format(emp.birth,'yyyy-MM-dd HH:mm:ss')}"></td>
                        <td>
                            <a class="btn btn-sm btn-primary"
                               th:href="@{/emp/{id}(id=${emp.id})}">编辑
                            </a>
                            <a class="btn btn-sm btn-danger"
                               th:href="@{/deleteEmp/{id}(id=${emp.id})}">删除
                            </a>
                        </td>
                    </tr>

                    </tbody>
                </table>
            </div>
        </main>
    </div>
</div>
<script th:src="@{js/jquery-3.5.1.slim.min.js}"
        integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj"
        crossorigin="anonymous"></script>
<script>window.jQuery ||
document.write('<script th:src="@{/js/jquery-3.5.1.slim.min.js}"><\/script>')</script>
<script th:src="@{/assets/dist/js/bootstrap.bundle.js}"></script>
<script th:src="@{/js/feather.js}"></script>
<script th:src="@{/static/chart.js}"></script>
<script th:src="@{/js/dashboard.js}"></script>
</body>
</html>
